home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 19 / madtrb40.zip / INSTX.210 < prev    next >
Text File  |  1985-09-08  |  16KB  |  337 lines

  1.  
  2. {$R+}
  3. {$V-}
  4. Program Instx;                                    { CIS Version 2.10   }
  5. {----------------------------------------------------------------------}
  6. {               Install the Turbo User Options                         }
  7. {----------------------------------------------------------------------}
  8. { Purpose:   Install Patches/Zaps to Load Modules                      }
  9. {                      (specifically the Turbo compiler)               }
  10. {                                                                      }
  11. { Methods:   Zaps are identified within a file by the concatenation of }
  12. {            a set of keywords consisting of:                          }
  13. {                                                                      }
  14. {                        "TITLE VERSION"                               }
  15. {                                                                      }
  16. {            where "TITLE" is choosen by the user and "VERSION"        }
  17. {            is a string derived from the first instruction in         }
  18. {            the binary file to receive the zap. The default Zap file  }
  19. {            is INSTX.ZAP which may be overridden by Menu item 1       }
  20. {                                                                      }
  21. { Input:     A zap text (patch) file consisting of Version identifiers,}
  22. {            Zap title + Version, zap offset, zap length, zap bytes,   }
  23. {            followed by a zero.                                       }
  24. {                                                                      }
  25. {            A source copy of the binary file to receive the zap.      }
  26. {            This file will be copied; not modified.                   }
  27. {                                                                      }
  28. { Output:    A copy of the source input file modified by the specified }
  29. {            zap(s).                                                   }
  30. {                                                                      }
  31. {----------------------------------------------------------------------}
  32. { Maintenance  Version                                                 }
  33. {    9.08.85    2.10   Correct Comspec/Path parm error for eXecution   }
  34. {                      Add Blinking attribute to Zap Color Window      }
  35. {                                                                      }
  36. {----------------------------------------------------------------------}
  37. {           Install the PcDos Turbo eXecute Command                    }
  38. {----------------------------------------------------------------------}
  39.  Type
  40.    Option_Choices = (None, Zap_Data, Com_Names, Edit_Intensity,
  41.                      Edit_Colors, X_command, User_Zap, Exit_Pgm);
  42.  
  43.    ZapTypes       = (No_Zap,Zap_Edit_Intensity,     { Zaps in Data File}
  44.                      Zap_Edit_Colors, Zap_X_Command,
  45.                      User_Zap_type);
  46.  
  47.  
  48.    ParmString     = String[255] ;      { Dummy definition for parms    }
  49.  
  50.  Const
  51.    Max_Versions = 8 ;                    { Number of Turbo Versions }
  52.    Actual_Versions :integer = Max_Versions;{ Versions acutally found}
  53.    Max_string   = 60;                    { Max Menu Title length    }
  54.    Max_Items    = 7;                     { Maximum menu items below }
  55.                                          { Menu items               }
  56.    Menu_Items: array[1..Max_Items] of string[Max_String] =
  57.                (' Specify Input Zap Data File ',
  58.                 ' Specify Input/Output .COM File Names ',
  59.                 ' Reverse Edit Intensity Attributes ',
  60.                 ' Specify Edit Screen Colors ',
  61.                 ' Install the eXecute Command ',
  62.                 ' User Specified Zap ',
  63.                 ' Exit this program ' );
  64.  
  65.  
  66.    Zap_Headers: array[Zap_Edit_Intensity..User_Zap_Type] { Define Zap  }
  67.                                    of string[10] =       { Headers     }
  68.                ('INTENSITY', 'COLORS', 'XCOMMAND', 'USER');
  69.  
  70.    ComIN_Filename   : string[64] = 'TURBO.COM';   { Input command file }
  71.    ComOUT_Filename  : string[64] = 'TURBX.COM';   { Output command file}
  72.    Zap_Filename     : string[64] = 'INSTX.ZAP';   { Default input data }
  73.  
  74.    Ok       :boolean = false;          { Boolean trash collector }
  75.  
  76.  Var
  77.    Zap_File :text;                     { Zap input data file           }
  78.    ComIN_File  : File of Byte;         { Input Command File            }
  79.    ComOUT_File : File of Byte;         { Output Command File           }
  80.    ComStartAddr:integer;               { Compiler Code start  addr     }
  81.    Option      :integer;
  82.    Choice      :Option_Choices;           { Set of User choices        }
  83.    i,j,
  84.    x,y         :integer;
  85.    Return_Code :integer;
  86.    A,B         :byte;
  87.  
  88.    Zap_Type   : Zaptypes;              { Parameter Strings passed to }
  89.    Version_Key :array[0..Max_Versions] of
  90.                record                    { Version 0 is no version  }
  91.                Verify     : integer;     { Unique Versify address   }
  92.                UniqueWord : integer;     { contents at versify addr }
  93.                Name       : string[8];   { 'PC300B','PC301A'  etc.  }
  94.                end;
  95.    Version    : integer;               { Set to current Version index }
  96.  
  97. {$I Nwindo.200}                        { Window Procedures              }
  98. {$I Menu.210}                          { Menu Display Function          }
  99. {$I CopyFile.200}                      { Duplicate a File               }
  100. {$I MakeZap.200}                       { Make Zaps to Output File       }
  101. {$I TPVers.200}                        { Open and find Compiler Version }
  102. {$I Scolor.200}                        { Select Compiler Color Option   }
  103. {$I Zcolor.210}                        { Zaps Colors into Compiler      }
  104. {-----------------------------------------------------------------------}
  105. {             G e t    U s e r   F i l e n a m e                        }
  106. {-----------------------------------------------------------------------}
  107. Procedure Get_User_Filename (Var  FileName :ParmString;
  108.                              var  Return_Code :integer);
  109.    Var
  110.       TempString   : string[64] ;
  111.       TempFile     : File ;
  112.    Begin
  113.       Readln(TempString);                       { user want new zap file }
  114.       If (TempString = '') then TempString := FileName; { Assign Default }
  115.       For I := 1 to length(TempString) do
  116.          TempString[I] := UpCase(TempString[I]);
  117.       Assign(TempFile,TempString);                      { filename if Cr }
  118.       {$I-} Reset(TempFile); {I+}
  119.       Return_Code := IOresult ;
  120.  
  121.    Close(Tempfile);                    { Close file for now..used later}
  122.    FileName := TempString;             { Assign the final File name    }
  123.    End; { Get_User_Filename }
  124. {----------------------------------------------------------------------}
  125. {     G e t  Z a p  I n p u t  D a t a  F i l e                        }
  126. {----------------------------------------------------------------------}
  127. Procedure Get_Zapdata_file ;       { Open user Specified Zap data      }
  128.    Begin
  129.  
  130.    Get_Abs_Cursor(x,y);            { Get current cursor position       }
  131.    MkWin(x,y+1,x+40,y+6,Green);      { Make an input window              }
  132.    Textcolor(Green);TextBackground(Black);GotoXy(1,1);
  133.  
  134.    Repeat
  135.       Write('  Patch (Zap) Data File ');
  136.       NormVideo;
  137.       Writeln(chr(16),' ',Zap_Filename,' ',chr(17));
  138.       LowVideo;
  139.  
  140.       Writeln(' Enter New File or <Return> to Accept ');
  141.       Get_User_Filename(Zap_Filename,Return_Code);
  142.  
  143.       If (Return_Code <> 0 ) then Writeln('   ', Zap_Filename, ' not found');
  144.    Until (Return_Code = 0 );
  145.    RmWin;                            { Remove the Window               }
  146.    End; { Get_Zapdata_file }
  147. {----------------------------------------------------------------------}
  148. {     C o m _ N a m e s :  G e t  .C o m   F i l e  N a m e s          }
  149. {----------------------------------------------------------------------}
  150. Procedure Get_Com_Names ;          { Open user Specified Command Files }
  151.    Begin
  152.  
  153.    Get_Abs_Cursor(x,y);            { Get current cursor position       }
  154.    MkWin(x,y+1,x+48,y+8,Blue);       { Make an input window              }
  155.    Textcolor(Yellow); TextBackground(Blue); Clrscr;
  156.  
  157.    Repeat { until ComIN_filename <> ComOUT_Filename }
  158.  
  159.    Repeat                                        { Get Input .COM File }
  160.       Write(' Default ');
  161.       NormVideo; Write('Input'); LowVideo;
  162.       Write(' .COM File ');                      { Ask user for input  }
  163.       NormVideo;                                 { or take the default }
  164.       Writeln(chr(16),' ',ComIN_Filename,' ',chr(17));
  165.       LowVideo;
  166.       Writeln(' Enter New File or <Return> to Accept ');
  167.       Get_User_Filename(ComIN_Filename,Return_Code);
  168.       If (Return_Code <> 0) then Writeln('   ', ComIN_Filename, ' not found');
  169.    Until (Return_Code = 0 );
  170.  
  171.       Write(' Default ');                        { Get OUTput filename }
  172.       NormVideo; Write('Output'); LowVideo;
  173.       Write(' .COM File ');                      { Ask user for input  }
  174.       NormVideo;                                 { or take the default }
  175.       Writeln(chr(16),' ',ComOUT_Filename,' ',chr(17));
  176.       LowVideo;
  177.       Writeln(' Enter New File or <Return> to Accept ');
  178.       Get_User_Filename(ComOUT_Filename,Return_Code);
  179.  
  180.    If (ComIN_Filename = ComOUT_Filename) then
  181.       Begin
  182.       NormVideo;
  183.       Writeln('Specify Separate Files for Input/Output Please');
  184.       LowVideo;
  185.       End;
  186.  
  187.    Until (ComIN_Filename <> ComOUT_Filename);
  188.                                      { Copy Compiler to Work File      }
  189.    CopyFile(ComIN_Filename,ComOUT_Filename,Return_Code);
  190.  
  191.    RmWin;                            { Remove the Window               }
  192.    End; { Get_Com_Names }
  193. {----------------------------------------------------------------------}
  194. {  Z a p  I n t e n s i t y : Transpose Compiler Edit Intensity        }
  195. {----------------------------------------------------------------------}
  196. Procedure Zap_Intensity;               { Reverse Compiler Intensity    }
  197.    Begin
  198.  
  199.    Get_Abs_Cursor(x,y);                  { Get current cursor position }
  200.    MkWin(x,y+1,x+48,y+8,White);            { Make an input window        }
  201.    Textcolor(Green); TextBackground(Black); Clrscr;
  202.  
  203.    Open_Compiler;                        { Open Compiler/Get Version   }
  204.    If (Return_Code = 0) then
  205.        Begin
  206.  
  207.        Zap_Type := Zap_Edit_Intensity;   { Pass parm to cause          }
  208.        Make_Zap(Zap_Type,Return_Code);   { Compiler  Intensity zaps    }
  209.  
  210.        If (Return_Code <> 0) then
  211.            Begin                         { Write Error msg and pause   }
  212.            Pause(' Error Processing Intensity Zap ');
  213.            end;
  214.        If (Return_Code = 0) then
  215.            Begin
  216.            Pause(' Compiler Intensity Zaps Completed ');
  217.            end;
  218.        end;
  219.    Close(Zap_file);Close(ComOut_File);
  220.    RmWin;
  221.    End; { Zap_Intensity }
  222. {----------------------------------------------------------------------}
  223. {  Z a p  X c m d : Install the PCDos eXecute Command                  }
  224. {----------------------------------------------------------------------}
  225. Procedure Zap_Xcmd;         { Install the PCDos Turbo eXecute command  }
  226.    Begin
  227.  
  228.    Get_Abs_Cursor(x,y);                  { Get current cursor position }
  229.    MkWin(4,y+1,76,y+9,Magenta);            { Make an input window        }
  230.    Textcolor(White); TextBackground(Red); Clrscr;
  231.  
  232.    Open_Compiler;                        { Open Compiler/Get Version   }
  233.    If (Return_Code = 0) then
  234.        Begin
  235.  
  236.        Zap_Type := Zap_X_Command;        { Pass parm to cause          }
  237.        Make_Zap(Zap_Type,Return_Code);   { Compiler  eXecute   zaps    }
  238.  
  239.        If (Return_Code <> 0) then
  240.            Begin                         { Write Error msg and pause   }
  241.            Pause(' Error Processing eXecute Zap ');
  242.            end;
  243.        If (Return_Code = 0) then
  244.            Begin
  245.            Pause(' Compiler eXecute Zap Completed ');
  246.            end;
  247.        end;
  248.    Close(Zap_file);Close(ComOut_File);
  249.    RmWin;
  250.    End; { Zap_Intensity }
  251. {----------------------------------------------------------------------}
  252. {  U  s  e  r   Z a p  : Execute a user specified zap from file        }
  253. {----------------------------------------------------------------------}
  254. Procedure User_Specified_Zap;           { Install a User Specified zap }
  255.    Var                                  { whose key we will obtain from}
  256.       TempStr :string[80];              { the console, then match up   }
  257.  
  258.     Procedure Exit_Out;                 { Provide Cleanup and Exit Rtn }
  259.        Begin
  260.        Close(Zap_file);Close(ComOut_File);
  261.        RmWin;
  262.        End;
  263.  
  264.    Begin                                 { with a Zap title in the file }
  265.    Get_Abs_Cursor(x,y);                  { Get current cursor position }
  266.    MkWin(4,y+1,76,y+9,Cyan+Bright);        { Make an input window        }
  267.    Textcolor(White); TextBackground(Blue); Clrscr;
  268.  
  269.    Open_Compiler;                        { Open Compiler/Get Version   }
  270.    If (Return_Code = 0) then
  271.        Begin
  272.        Zap_Type := User_Zap_Type;        { Index is User Zap type      }
  273.        Writeln(' Enter the search Keyword for this ZAP:');
  274.        Readln(TempStr);                  { Ask user for the zap Key    }
  275.  
  276.        If (Ord(TempStr[0]) < 1) or (TempStr[1] <= ' ')
  277.           then Begin Exit_Out; Exit; End;
  278.  
  279.        Zap_Headers[User_Zap_Type] := TempStr;
  280.        Make_Zap(Zap_Type,Return_Code);   { Find and Make the Zap       }
  281.  
  282.        If (Return_Code <> 0) then
  283.            Begin                         { Write Error msg and pause   }
  284.            Pause(' Error Processing User Zap ');
  285.            end;
  286.        If (Return_Code = 0) then
  287.            Begin
  288.            Pause(' User Specified Zap Completed ');
  289.            end;
  290.        end;
  291.    Exit_Out;
  292.    End; { User_Specified_Zap }
  293. {----------------------------------------------------------------------}
  294. {         S a y   B y e   B y e  : Terminate Program                   }
  295. {----------------------------------------------------------------------}
  296. Procedure Say_ByeBye;
  297.    Begin
  298.       Writeln ('   Bye Bye');
  299.    End   ;
  300. {----------------------------------------------------------------------}
  301. {                M a i n   P r o c e d u r e                           }
  302. {----------------------------------------------------------------------}
  303. Begin {Main}
  304.  
  305. {----------------------------------------------------------------------}
  306. {               S h o w  M e n u  O p t i o n s                        }
  307. {----------------------------------------------------------------------}
  308.     MkWin(1,1,Max_String,Max_Items+8,Yellow); { Make an Options Window }
  309.  
  310.   Repeat {until Choice = Exit_Pgm}
  311.      Textcolor(Bright+Cyan); TextBackground(Green);
  312.      Option := Menu(Max_Items,Menu_Items);    { Fetch User Choice      }
  313.      Choice := Option_Choices(Option);        { Translate to Case      }
  314.  
  315.      Case Choice of                  { Execute Sub-Menu Options        }
  316.         Zap_data        : Get_Zapdata_file;
  317.         Com_names       : Get_Com_names;
  318.         Edit_Intensity  : Zap_Intensity;
  319.         Edit_Colors     : Zap_Colors;
  320.         X_command       : Zap_Xcmd;
  321.         User_Zap        : User_Specified_Zap;
  322.         None,Exit_Pgm   : Say_ByeBye
  323.  
  324.         else
  325.            Begin
  326.            Beep(600);
  327.            Clrscr;
  328.            Pause ('...Undefined program funtion.');
  329.            end;
  330.      end; { Case Choice }
  331.    Until (Choice = Exit_Pgm) or (Choice = None);
  332.      RmWin;
  333.  
  334. (**)
  335. End. { Main }
  336. {......................................................................}
  337.